﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#btnlogin").click(function () {
                $.ajax({
                    url: "WebForm1.aspx/CheckLogin",
                    type: "post",
                    data: "{'username':'" + $("#txtusername").val() + "','pass':'" + $("#txtpassword").val() + "'}",
                    contentType: "application/json; charset=UTF-8",
                    dataType: "json",
                    beforeSend: function () {
                        $("#lbAlert").html("Checking");
                    },
                    success: function (data) {
                        if (data.d == "y") {
                            $("#lbAlert").html("Ok");
                        }
                        else {
                            $("#lbAlert").html("No");
                        }
                    }
                });
            });
        });
    </script>
</head>

<body>
    <form id="form1" runat="server">
    <div>
        <input id="txtusername" type="text" />
        <input id="txtpassword" type="text" />
        <input id="btnlogin" type="button" />
        <span id="lbAlert"></span>
    </div>
    </form>
</body>
</html>
